package com.example.xyxwebbackend001.controller;

import com.example.xyxwebbackend001.common.CommonResult;
import com.example.xyxwebbackend001.model.entity.*;
import com.example.xyxwebbackend001.model.vo.ComArtDetailsVO;
import com.example.xyxwebbackend001.model.vo.CommendListVO;
import com.example.xyxwebbackend001.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/commend")
public class CommendController {
    @Autowired
    private RecommendService recommendService;
    @GetMapping("/food/list")
    public CommonResult<List<CommendListVO>> getFoodList(@RequestParam(required = false) String cityId) {
        List<CommendListVO> foodList = recommendService.getRecommendFoodList(cityId);
        return CommonResult.success(foodList);
    }
    @GetMapping("/food/details")
    public CommonResult<ComArtDetailsVO> getFoodDetails(@RequestParam String id) {
        ComArtDetailsVO foodDetails = recommendService.getCommendFoodDetails(id);
        return CommonResult.success(foodDetails);
    }
    @GetMapping("/tradCraft/list")
    public CommonResult<List<CommendListVO>> getTradCraftList(@RequestParam(required = false) String cityId) {
        List<CommendListVO> tradCraftsList = recommendService.getRecommendTradCraftList(cityId);
        return CommonResult.success(tradCraftsList);
    }

    @GetMapping("/tradCraft/details")
    public CommonResult<ComArtDetailsVO> getTradCraftDetails(@RequestParam String id) {
        ComArtDetailsVO tradCraftDetails = recommendService.getCommendTradCraftDetails(id);
        return CommonResult.success(tradCraftDetails);
    }

    @GetMapping("/tourist/list")
    public CommonResult<List<CommendListVO>> getTouristList(@RequestParam(required = false) String cityId) {
        List<CommendListVO> touristList = recommendService.getRecommendTouristList(cityId);
        return CommonResult.success(touristList);
    }

    @GetMapping("/tourist/details")
    public CommonResult<ComArtDetailsVO> getTouristDetails(@RequestParam String id) {
        ComArtDetailsVO touristDetails = recommendService.getCommendTouristDetails(id);
        return CommonResult.success(touristDetails);
    }

    @GetMapping("/event-calendar/list")
    public CommonResult<List<EventCalendar>> getEventCalendarList(@RequestParam(required = false) String cityId) {
        List<EventCalendar> eventCalendarList = recommendService.getRecommendEventCalendarList(cityId);
        return CommonResult.success(eventCalendarList);
    }
    @GetMapping("/event/today-recommend")
    public CommonResult<List<TodayRecommend>> getTodayRecommendList(@RequestParam(required = false) String cityId) {
        List<TodayRecommend> eventCalendarList = recommendService.getTodayRecommendList(cityId);
        return CommonResult.success(eventCalendarList);
    }
}
